
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>发送短信</title>
    <link rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/css/base/base.css?20201106.1">
    <link rel="stylesheet" href="/css/notice/noticeManagement.css">
    <script src="/js/common/language.js"></script>
    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.fileupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/base/base.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <script src="/lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/ajaxupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/jquery/jquery.cookie.js"></script>
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>
    <style>
        table tbody td{
            text-align: left;
            padding: 10px;
            box-sizing: border-box;
        }
        table tbody td.color{
            padding:10px 10px 10px 50px;
        }
        input{
            float: none;
        }
        .editAndDelete3{
            color: red;
        }
        .color{
            font-size: 11pt;
            color: #2a588c;
            font-weight: bold;
        }
        table tbody td textarea{
            width: 229px;
            height: 34px;
            line-height: 34px;
            padding-left: 10px;
            outline: none;
            border-radius: 4px;
            vertical-align: middle;
            font-family:"Microsoft Yahei";
        }
        table tbody td a{
            vertical-align: middle;
            font-size: 11pt;
        }
        table tbody td select{
            width: 119px;
            height: 28px;
            border-radius: 4px;
        }
        table tbody td input[type=text]{
            width: 288px;
            height: 32px;
            border-radius: 4px;
            padding-left: 10px;
            box-sizing: border-box;
        }
        .btnsava{
            padding:5px 15px;
            border-radius: 4px;
            background: #2F8AE3;
            color: #fff;
        }
        .pagediv .page-bottom-outer-layer table td{
            text-align: left;
        }
        .pagediv .page-bottom-outer-layer table td:last-child{
            border-right: 1px #dddddd solid;
        }
        .editAndDelete2{
            color: red;
        }
        .delete_check {
            display: inline-block;
            width: 70px;
            height: 28px;
            position: relative;
            color: #ffffff;
            border-radius: 3px;
            background: #2b7fe0;
            text-align: center;
            line-height: 28px;
            margin-left: 20px;
        }
        .bar {
            height: 18px;
            background: green;
        }

        .query{
            width: 600px;
        }

        /*table tr.borderNone{*/
        /*border:none;*/
        /*}*/
    </style>
    <%--<script src="/js/learningExperience/LearningExperienceQuery.js"></script>--%>
</head>
<body style="overflow: hidden">
<div class="navigation">
    <%--<img src="/img/commonTheme/${sessionScope.InterfaceModel}/gonggaochaxun.png" alt="">--%>
    <%--<h2>学习经历信息查询</h2>--%>
</div>
<div class="query">
    <div class="header">发送短信</div>
    <form id="uploadForm" method="post" action="/sms2/sendMessageByExcel" enctype="multipart/form-data" >
        <table style="width: 100%;    border: 1px solid #c0c0c0;
    border-top: none;">
            <tbody>
            <tr class="borderNone">
                <td width="40%" class="color">收信人[内部用户]：</td>
                <td width="70%">
                    <textarea name=""  class="theControlData"  readonly id="userId" cols="30" rows="10"></textarea>
                    <a href="javascript:;" class="addroles">选择</a>
                    <a href="javascript:;" class="cleardate"><fmt:message code="global.lang.empty"/></a>
                    <input type="hidden" name="userId">
                </td>
            </tr>

            <tr class="borderNone">
                <td width="30%" class="color">外部人员：</td>
                <td width="70%">
                    <input type="file" name="file" id="wj" value="<fmt:message code="file.th.PleaseSelectFile" />"/>
                    <a href="../file/sms/短信发送模板.xls" style="color: #0088cc;font-size: 10pt;margin-left: 2px;">信息模板下载</a>
                </td>
            </tr>

            <tr class="borderNone">
                <td width="30%" class="color">短信内容：</td>
                <td width="70%">
                    <textarea style="height: 88px;width: 280px;line-height: 17px" name="contextString"  class="theControlData"  id="cont" cols="30" rows="10"></textarea>

                </td>
            </tr>


            <tr class="borderNone">
                <td colspan="2" style="text-align: center;padding: 15px">
                    <a href="javascript:;" class="btnsava send">发送</a>
                    <a href="javascript:;" style="margin-left: 10px" class="btnsava qian">签名</a>
                    <a href="javascript:;" style="margin-left: 10px" class="btnsava clear">清空</a>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>
<div id="pagediv" style="visibility:hidden;">

</div>
<script type="text/javascript">
    var user_id=null;
$('.clear').click(function () {
//    $('#userId').val('');
//    $('#cont').val('');
    window.location.reload()
})

    $(document).on('click','.cleardate',function () {
        $(this).siblings('textarea').val('')
        $(this).siblings('textarea').attr('user_id','');
        $(this).siblings('textarea').attr('deptid','');
        $(this).siblings('textarea').attr('deptname','');
        $(this).siblings('textarea').attr('privid','');
        $(this).siblings('textarea').attr('userpriv','');
        $(this).siblings('textarea').attr('username','');
        $(this).siblings('textarea').attr('dataid','');
        $(this).siblings('textarea').attr('userprivname','');
    })

$('.addroles').click(function () {
    user_id = $(this).siblings('textarea').prop('id');
    $.popWindow("../common/selectUser");
})

//发送
$('.send').click(function () {

    if($('#wj').val()){
        $('#uploadForm').ajaxSubmit({
            dataType: 'json',
            data:{
                privArray:$('#userId').attr('dataid'),
            },
            success:function (res) {
                if(res.flag) {
                    $.layerMsg({content:"发送成功！",icon: 1}, function(){
                        window.location.reload()
                    });
                }else{
                    $.layerMsg({content:"发送失败！",icon: 2}, function(){
                    });
                }
            }
        })

    }else {
        if($('#userId').val() == ''){
            $.layerMsg({content:"请填写收信人！",icon: 2}, function(){
            });
            return;

        }
        $.ajax({
            type:'get',
            url:'/sms2Priv/smsSenders',
            dataType:'json',
            data:{
                contextString:$('#cont').val(),
                privArray:$('#userId').attr('dataid') || '',
            },
            success:function(res){
                if(res.flag) {
                    $.layerMsg({content:"发送成功！",icon: 1}, function(){
                        window.location.reload()

                    });
                }else{
                    $.layerMsg({content:"发送失败！",icon: 2}, function(){

                    });
                }

            }
        })
    }

})

//签名
$('.qian').click(function () {

    $.ajax({
        type:'get',
        url:'/smsSettings/selectSmsSettings',
        dataType:'json',
        success:function(res){
            if(res.flag) {
                var obj = res.obj;
                var sign = obj[0].sign;
                $("#cont").val($("#cont").val() + sign)
            }

        }
    })

})

</script>
</body>
</html>